package me.zhengjie.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import me.zhengjie.base.BaseEnum;
import org.springframework.util.StringUtils;

import java.math.BigInteger;

@Getter
@AllArgsConstructor
public enum BlockChainEnum {

    ETH_FRX_TEST("FRX_TEST", "FRX_TEST", "http://127.0.0.1:40000", new BigInteger("31337"), new BigInteger("60000"), "forsix_test"),
    ETH_FRX("FRX", "FRX", "http://192.168.1.28:9090", new BigInteger("31337"), new BigInteger("60000"), "forsix"),
    ETH_BNB_TEST("BNB_TEST", "BNB_TEST", "https://data-seed-prebsc-1-s1.binance.org:8545", new BigInteger("97"), new BigInteger("60000"), "bscscan_test"),
    ;

    private String name; // 链名称
    private String code; // 链标识代码
    private String rpcUrl; // 链地址
    private BigInteger chainId; // 链ID
    private BigInteger gasLimit; // gasLimit
    private String descr; // 描述

    public static BlockChainEnum find(String code) {
        return StringUtils.isEmpty(code) ? null : BaseEnum.findOne(values(), en -> en.code.equals(code));
    }
}
